//检索
function searchs(){
    top.jzts();
    $("#form").submit();
}

//详情
function detail(id) {
    top.jzts();
    var diag = new top.Dialog();
    diag.Drag = true;
    diag.Title = "详情";
    diag.URL = path + '/admin/bannerConf/detailPage?id='+ id;
    diag.Width = 1050;
    diag.Height = 980;
    diag.CancelEvent = function(){ //关闭事件
        diag.close();
    };
    diag.show();
}

//新增
function add(currentPage){
    top.jzts();
    var diag = new top.Dialog();
    diag.Drag = true;
    diag.Title ="新增";
    diag.URL = path + '/admin/bannerConf/addPage';
    diag.Width = 1050;
    diag.Height = 980;
    diag.CancelEvent = function(){//关闭事件
        if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
            if(currentPage == '0'){
                top.jzts();
                setTimeout("self.location=self.location",100);
            }else{
                nextPage(currentPage);
            }
        }
        diag.close();
    };
    diag.show();
}

//编辑
function edit(id, currentPage){
    top.jzts();
    var diag = new top.Dialog();
    diag.Drag = true;
    diag.Title ="编辑";
    diag.URL = path + '/admin/bannerConf/editPage?id=' + id;
    diag.Width = 1050;
    diag.Height = 980;
    diag.CancelEvent = function(){//关闭事件
        if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
            if(currentPage == '0'){
                top.jzts();
                setTimeout("self.location=self.location",100);
            }else{
                nextPage(currentPage);
            }
        }
        diag.close();
    };
    diag.show();
}

//上下架
function onOrOff(id, state, msg, currentPage) {
    bootbox.confirm("您确定要" + msg + "该banner吗？", function(result) {
        if(result) {
            top.jzts();
            var url = path +'/admin/bannerConf/onOrOff?id=' + id + "&state=" + state;
            $.get(url,function(data){
                top.hangge();
                bootbox.dialog({
                    message: "<span class='bigger-110'>" + data.msg + "</span>",
                    buttons: {
                        "button":{
                            "label":"确定",
                            "className":"btn-sm btn-success",
                            "callback": function() {
                                nextPage(currentPage);
                            }
                        }
                    }
                });
            });
        }
    });
}
